//
//  CZHomeTileButton.swift
//  XLWB009
//
//  Created by apple on 3/27/16.
//  Copyright © 2016 apple. All rights reserved.
//

import UIKit

class CZHomeTileButton: UIButton {

   convenience init(title:String?,imageName:String){
            self.init()
    
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        setImage(UIImage(named:imageName), forState: UIControlState.Normal)
        sizeToFit()
    
    }

    override func layoutSubviews() {
        super.layoutSubviews()
       
        //调整图片的位置
        //将titleLabel往左移
        titleLabel!.frame.origin.x=0
        
        //图片一道titleLabel后面
        imageView!.frame.origin.x=titleLabel!.frame.width+3
    }
}
